<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>平台管理系统</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport"
		  content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body>

<div class="layui-fluid">
	<div class="layui-row layui-col-space12">
		<div class="layui-col-md12">
			<div class="layui-card">
				<div class="layui-form layui-card-header layuiadmin-card-header-auto">
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">查询天数</label>
							<div class="layui-input-inline">
								<input type="text" id="timeDays" name="timeDays" placeholder="请输入查询天数" autocomplete="off"
									   class="layui-input" value="${vo.timeDays}">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">显示数量</label>
							<div class="layui-input-inline">
								<input type="text"  id="searchNum" name="searchNum" placeholder="请输入显示数量" autocomplete="off"
									   class="layui-input" value="${vo.searchNum}" >
							</div>
						</div>
						<div class="layui-inline">
							<button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
								<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
							</button>
						</div>
					</div>
					<div class="layui-card-header">近<span id="changeDay">30</span>天订单退款TOP<span id="changeNum">10</span></div>
				</div>
				<div class="layui-card-body">
					<table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
					<script type="text/html" id="table-operate">
						<a class="layui-btn layui-btn-xs" lay-event="detail">查看明细</a>
					</script>
					<script type="text/html" id="index">
						{{d.LAY_TABLE_INDEX+1}}
					</script>
				</div>
			</div>
		</div>
	</div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script>


	layui.config({
		base: '/layuiadmin/' //静态资源所在路径
	}).extend({
		index: 'lib/index' //主入口模块
	}).use(['index', 'table'], function () {
		var table = layui.table, form = layui.form;

		table.render({
			elem: '#LAY-app-content-list'
			, url: '/account/queryOrderRefund'
			, totalRow: true
			, cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
			, cols: [[
				{field: 'id', title: '序号', width: 80, fixed: 'left', templet: '#index'},
				{field: 'bid', minWidth: 80, title: '商家编号', sort: true, totalRowText: '小计：'},
				{field: 'refundMoney', minWidth: 80, title: '退款金额', sort: true, totalRow: true},
				{field: 'refundNum', minWidth: 80, title: '退款数量', sort: true, totalRow: true},
				{field: 'phone', minWidth: 80, title: '联系电话'},
				{field: 'nickNameOn', title: '商家线上名称', minWidth: 80},
				{field: 'nickName', title: '商家线下名称', minWidth: 80},
				{field: 'industryName', title: '所属行业', minWidth: 80},
				{title:'操作',width:178, align:'center', fixed: 'right', toolbar: '#table-operate'}
			]]
		});

		//监听搜索
		form.on('submit(LAY-app-contlist-search)', function (data) {
			var field = data.field;
			var timeDays = field.timeDays;
			var searchNum = field.searchNum;
			if (timeDays == null || timeDays == '' || timeDays == undefined) {
				timeDays = 30;
			}
			if (searchNum == null || searchNum == '' || searchNum == undefined) {
				searchNum = 10;
			}
			layui.$('#changeDay').text(timeDays);
			layui.$('#changeNum').text(searchNum);

			//执行重载
			table.reload('LAY-app-content-list', {
				where: field
			});
		});

		//监听工具条
		table.on('tool(LAY-app-content-list)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
			var data = obj.data; //获得当前行数据
			var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
			var tr = obj.tr; //获得当前行 tr 的DOM对象
			var timeDays = layui.$('input[name="timeDays"]').val();
			if(layEvent === 'detail'){ //查看
				window.location.href='/account/businessOrderRefundDetail?timeDays='+timeDays+'&bid='+data.bid;
			}
		});
	});
</script>
</body>
</html>
